package by.ins.app;


import org.apache.log4j.Logger;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

public class SpringApplicationListener implements ApplicationListener<ApplicationEvent>  {
	
	private static final Logger log = Logger.getLogger(SpringApplicationListener.class);

	@Override
	public void onApplicationEvent(ApplicationEvent event) {
		log.info(event.toString());
		
		if ( !AppContext.getApp().isStarted()  && AppContext.getApp().isRunStartUpCommand() ){
			
			AppContext.getApp().startApp();
			
		}
		
	}

}
